#!/usr/bin/env python
#coding=utf-8
from phprpc import PHPRPC_WSGIApplication, UrlMapMiddleware
from beaker.middleware import SessionMiddleware
from google.appengine.ext.webapp.util import run_wsgi_app
from sso.Member import reg,login,update,logout,check




server = PHPRPC_WSGIApplication(sessionName = 'beaker.session')
server.add(reg)
server.add(login)
server.add(update)
server.add(logout)
server.add(check)
server.debug = True

server = UrlMapMiddleware([('/', server)])
server = SessionMiddleware(server, type='ext:google', table_name="beaker_session", cookie_expires=False)
run_wsgi_app(server)

#print 'qq'
#print reg('qqqqqq1', '123456', 'bawbaw.hu1@gmail.com')
#print login('bawbaw','618047')
#print logout()
#print update('bawbaw.hu@gmail.com', '12345678',{'user':{'mail':'bawbaw.hu@gmail.com'}})
#for site in Config.get_instance()['sites']:
#    print site
#print Config.get_instance()['mail']['msg_body'].encode('utf-8')
#info = {}
#info['email'] = 'bawbaw.hu@gmail.com'
#info['username'] = 'bawbaw'
#send_verify_mail(info)